﻿using DMSkin.WPF;
using MXComponent.Api;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace MXComponent
{
    /// <summary>
    /// MainWindowApp.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindowApp : Window
    {
        public MainWindowApp()
        {
            InitializeComponent();
        }

        private void DMSkinSimpleWindow_Loaded(object sender, RoutedEventArgs e)
        {
            this.WindowState = WindowState.Maximized;
            this.materialDown.IsChecked = true;
            MainFrame.Navigate(PageManager.Fdown, UriKind.Relative);
            this.LblUser.Text = GlobalClass.user.username;
            if(!GlobalClass.user.IsSystem)
            {
                changepassword.Visibility= Visibility.Hidden;
                material.Visibility = Visibility.Collapsed;
                materialwarehouse.Visibility = Visibility.Collapsed;
                formulaList.Visibility = Visibility.Collapsed;
            }
        }

        private void ImageRadioButton_Click(object sender, RoutedEventArgs e)
        {
        }

        private void ImageRadioButton_Checked(object sender, RoutedEventArgs e)
        {
        }

        private void Material_Click(object sender, RoutedEventArgs e)
        {
            MainFrame.Navigate(PageManager.Materiallist, UriKind.Relative);
        }

        private void Materialwarehouse_Click(object sender, RoutedEventArgs e)
        {
            MainFrame.Navigate(PageManager.Materialwarehouselist, UriKind.Relative);
        }

        private void FormulaList_Click(object sender, RoutedEventArgs e)
        {
            MainFrame.Navigate(PageManager.Formulalist, UriKind.Relative);
        }

        private void changepassword_Click(object sender, RoutedEventArgs e)
        {
            MainFrame.Navigate(PageManager.ChangePPage, UriKind.Relative);
        }

        private void MaterialDown_Click(object sender, RoutedEventArgs e)
        {
            MainFrame.Navigate(PageManager.Fdown, UriKind.Relative);
        }   

        private void materialChar_Click(object sender, RoutedEventArgs e)
        {
            MainFrame.Navigate(PageManager.Mchar, UriKind.Relative);
        }

        private void formulaReport_Checked(object sender, RoutedEventArgs e)
        {
            MainFrame.Navigate(PageManager.Freport, UriKind.Relative);
        }

        private void formulaDetail_Checked(object sender, RoutedEventArgs e)
        {
            MainFrame.Navigate(PageManager.Fdetail, UriKind.Relative);
        }

        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            Environment.Exit(0);
        }

        private void formulaChar_Click(object sender, RoutedEventArgs e)
        {
            MainFrame.Navigate(PageManager.Fchar, UriKind.Relative);
        }
    }
}